

import com.kirillam.handy.core.HATObject;
import com.kirillam.handy.core.HATControlClip;

import com.kirillam.handy.events.HATEvent;



/** Basic Handy visual clip. */

class com.kirillam.handy.core.HATClip extends HATObject
{


	/** Constructor */
		
	public function HATClip()
	{
		super();
		
		useHandCursor	= false;
		_focusrect 		= false;
		
		invalidateUI();
	}
	
	
	private function onUnload()
	{
		cleanUp();
	}
	
	
	/** Override and call super.cleanUp() at the end to perform cleanup right before the clip is removed. */
	
	private function cleanUp()
	{
	}
	
	
	/** Call to invalidate the UI layout of this clip. Makes the clip execute its redrawUi() function once at the end of the frame.  */
	
	public function invalidateUI()
	{
		HATControlClip.instance.handle( HATEvent.RENDER, this, onInvalidate );
	}
	
	
	/* Handles HATEvent.RENDER event and makes the clip relayout its UI elements. */
	
	private function onInvalidate()
	{
		HATControlClip.instance.ignore( HATEvent.RENDER, this );
		redrawUI();
	}
	
	
	/** Override to relayout the UI elements of this clip or do any redrawing. */
	
	private function redrawUI()
	{
	}
}